<template>
    <!--    引入container布局-->
    <el-container class = "home-container">
        <el-header>
            <div>
                <img src="../assets/QQ.png" alt/>
                <span>员工信息管理系统-管理员系统</span>
            </div>
            <el-button type="info" @click ="logout">安全退出</el-button>
        </el-header>
        <!--        主体-->
        <el-container>
            <!--            侧边栏-->
            <el-aside width="200px">
                <el-menu background-color="#545c64"
                         text-color="#fff"
                         active-text-color="#409eff"
                         router
                >
                    <el-submenu index="1">
                        <template slot="title">
                            <i class="el-icon-location"></i>
                            <span>信息管理</span>
                        </template>
                        <el-menu-item index="/admin/adminDepartment">
                            <span slot="title">部门信息管理</span>
                        </el-menu-item>
                        <el-menu-item index="/Admin/adminWorker">
                            <span slot="title">员工信息管理</span>
                        </el-menu-item>
                        <el-menu-item index="/Admin/adminTask">
                            <span slot="title">任务信息管理</span>
                        </el-menu-item>
                        <el-menu-item index="/Admin/adminProfit">
                            <span slot="title">业绩信息管理</span>
                        </el-menu-item>
                        <el-menu-item index="/Admin/adminAttendance">考勤信息管理</el-menu-item>
                        <el-menu-item index="/admin/adminSalary">薪资信息管理</el-menu-item>
                        <el-menu-item index="/admin/adminHolidayAgree">假期申请审核</el-menu-item>
                    </el-submenu>
                    <el-menu-item index="/admin/adminCenter">
                        <i class="el-icon-setting"></i>
                        <span slot="title">个人信息</span>
                    </el-menu-item>
                </el-menu>
            </el-aside>
            <el-main>
                <router-view>

                </router-view>
            </el-main>
        </el-container>
    </el-container>
</template>

<script>
    export default {
        //onload事件
        created() {
            //回车监听事件
            var _this = this;
            document.onkeydown = function(e) {
                let key = window.event.keyCode;
                if (key == 13) {
                    _this.login();
                }
            }
        },
        methods:{
            //安全退出
            logout(){
                window.sessionStorage.clear();//清除session
                this.$router.push("/login");
            },
        },

    }
</script>
<style lang="less" scoped>
    .el-header {
        background-color: #373d41;
        display: flex;
        justify-content: space-between;// 左右贴边
        padding-left: 0%;// 左边界
        align-items: center;// 水平
        color: #fff;
        font-size: 20px;
        > div { //左侧div加布局
            display: flex;
            align-items: center;
            span {
                margin-left: 15px;
            }
        }
    }.el-aside {
         background-color: #333744;
         .el-menu{
             border-right: none;// 对其右边框
         }
     }
    .el-main {
        background-color: #eaedf1;
    }
    .home-container {
        height: 100%;
    }
    .logo_img {
        width: 20%;
        height: 100%;
    }
    .iconfont{
        margin-right: 10px;
    }
    .toggle-button{
        background-color:#4A5064;
        font-size: 10px;
        line-height: 24px;
        color:#fff;
        text-align: center;
        letter-spacing: 0.2em;
        cursor: pointer;// 显示鼠标指针为：小手
    }
</style>